<HTML>
<BODY>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
     <B>NAME</B>
          pnet_addconnect - Add connection to network

     <B>SYNOPSIS</B>
          <B>#include</B> <B>&lt;mpi.h&gt;</B>
          <B>#include</B> <B>"pnet.h"</B>

          <B>int</B> <B>pnet_addconnect(Pnet</B> *<I>pnet</I><B>,</B> <B>int</B> <I>to</I><B>,int</B> <I>from</I><B>);</B>

     <B>DESCRIPTION</B>
          The function adds a connection to the network. Must be
          called after <B>pnet_init</B> and before <B>pnet_setup</B>.  The arguments
          of <B>pnet_addconnect</B> are:

          <I>pnet</I> Pointer to initialized Pnet struct

          <I>to</I>   Target node of connection

          <I>from</I> Source node of connection

     <B>RETURN</B> <B>VALUE</B>
          Upon successful completion PNET_OK is returned.

     <B>ERRORS</B>
          <B>PNET_TO_INDEX_ERR</B>
               target node is not in the range of
               pnet_lo(pnet),...,pnet_hi(pnet).

          <B>PNET_FROM_INDEX_ERR</B>
               Source node is not in the range of
               0,...,pnet_nodes(pnet)-1.

          <B>PNET_ALLOC_ERR</B>
               Cannot allocate memory for connection.

     <B>EXAMPLE</B>
          Create network with all to all connections
               Pnet *pnet;
               int i,j;
               MPI_Init(&amp;argc,&amp;argv);
               pnet=pnet_init(MPI_COMM_WORLD,MPI_FLOAT,100)
               for(i=pnet_lo(pnet);i&lt;=pnet_hi(pnet);i++)
                 for(j=0;j&lt;100;j++)
                   pnet_addconnect(pnet,i,j);
               pnet_setup(pnet);

     <B>AUTHORS</B>
          For authors and contributors see AUTHORS file


     <B>COPYRIGHT</B>
          (C) Potsdam Institute for Climate Impact Research (PIK), see
          COPYRIGHT file


     <B>SEE</B> <B>ALSO</B>
          <B><A HREF="pnet_init.html">pnet_init(3)</A></B>, <B><A HREF="pnet_free.html">pnet_free(3)</A></B>, <B><A HREF="pnet_setup.html">pnet_setup(3)</A></B>, <B><A HREF="pnet_lo.html">pnet_lo(3)</A></B>,
          <B><A HREF="pnet_hi.html">pnet_hi(3)</A></B>, <B><A HREF="pnet_nodes.html">pnet_nodes(3)</A></B>














































</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
